#ifndef MAPWINDOW_H
#define MAPWINDOW_H
#include "Image.h"
#include "GLWindow.h"
#include "TileSheet.h"
#include <Level.h>
#include <QScrollBar>
#include <NewBox.h>

#include <Camera.h>


/// @HOLY SHIT IT WORKS i finally got the rendering on both windows to work, i hope i can keep this up!!
class MapWindow : public GLWindow
{
    Q_OBJECT
public:
    MapWindow(QWidget *parent = 0);
    ~MapWindow();

    void Load();

    void Save();
    void New();
    void LoadTile(std::string imagedir);

    void SaveDS(std::string name) { myLevel.SaveDS(name); }

    Level& GetLevel() { return myLevel; }

    void paintEvent(QPaintEvent*);

    void mouseMoveEvent(QMouseEvent *clicked);

    void SetCurrentLayer(int);
    void ShowLayer(int , bool);

protected:
    void initializeGL();
    void paintGL();

    int myTileSize;

    Level myLevel;
    TileSheet myTileSheet;
    NewBox* myNewBox;
    Camera myCamera;

    QScrollBar myHorizontalScroll;
    QScrollBar myVerticalScroll;

public slots:
    void MoveCameraX(int x);
    void MoveCameraY(int y);
};

#endif // MAPWINDOW_H
